<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/6/26
 * Time: 16:42
 */

namespace App\Http\Controllers\Api;

use Illuminate\Support\Facades\DB;
use App\Services\UserService;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Services\NewsService;
use App\Lib\Util\ResponseUtil;
use Illuminate\Support\Facades\Schema;
use App\News;

class NewsController extends Controller
{
    private $newsService = null;

    public function __construct(NewsService $newsService)
    {
        $this->newsService = $newsService;
    }

//    列表
    public function getNewsList(Request $request)
    {
        $news = $this->newsService->getNews($request->all(),[
            News::$NEWS_TYPE
        ]);

        return ResponseUtil::jsonResponse(true,0,'',$news);
    }

//    详情
    public function getNewsDetail(Request $request)
    {
        $new = $this->newsService->getNewsDetail($request->all());
        return ResponseUtil::jsonResponse(true, 0, '', $new);
    }
}